package ru.spb.nicetu.schoolproject;

import ru.spb.nicetu.schoolproject.data.HibernateTblModel;
import ru.spb.nicetu.schoolproject.data.NumberOfPupil;

import javax.swing.*;

/**
 * Created by dchernyshov on 23.04.15.
 */
public class TblModelForNumberOfPupils extends HibernateTblModel<NumberOfPupil> {

    public TblModelForNumberOfPupils() {
        super(NumberOfPupil.class, 2);
    }

    @Override
    public String getColumnName(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return "Класс";
            case 1:
                return "Кол-во учеников";
            default: return "";
        }
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    @Override
    public Object getValueAt(int i, int i1) {
        NumberOfPupil numberOfPupil = list.get(i);
        switch (i1) {
            case 0:
                return numberOfPupil.getClazz();
            case 1:
                return numberOfPupil.getNumber();
            default:
                return null;
        }
    }
}
